package com.biscuit.page.basicservice.conf.initialize;

import com.biscuit.page.basicservice.design.flow_limit.factory.FlowLimitStrategyFactory;
import com.biscuit.page.basicservice.design.flow_limit.strategy.FlowLimitHandlerStrategy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @author biscuit
 * @create 2024年07月30日 14:49
 */
@Configuration
public class FlowLimitHandlerStrategyInitialize {

    @Value("${flow-limit.strategy:-1}")
    private Integer flowLimitStrategy;

    @Bean
    @Primary
    public FlowLimitHandlerStrategy flowLimitHandlerStrategy() {
        return FlowLimitStrategyFactory.create(flowLimitStrategy);
    }

}
